// 搜索的时候的节流函数
function throttle (fn , delay) { 
    var t = null;
    let  begin = new Date().getTime();

        return function () { 
            var _self = this;
            let  args = arguments;
            let cur = new Date().getTime();

            clearTimeout(t);

        if (cur-begin >= delay) {
            fn.apply(_self , args);
            begin = cur;

        }else{
            t = setTimeout( () => {
                fn.apply(_self , args);
            }, delay);
        }
     }
 }

 export  { throttle }